<template>
  <div>
    <el-container>
      <el-header>
        <div class="box">
          <nav style="display: flex; justify-content: space-between">
            <div>
              <router-link to="/home" style="display: flex"
                ><img src="https://flowbite.com/docs/images/logo.svg" /><span
                  style="color: black; font-size: 28px"
                  >氢氦锂铍硼</span
                ></router-link
              >
            </div>
            <div>
              <el-menu
                :default-active="handleSelect"
                class="el-menu-demo"
                active-text-color="#4ec7ff"
                mode="horizontal"
                router
              >
                <el-menu-item index="/home/index">首页</el-menu-item>
                <el-menu-item index="/home/classify">分类</el-menu-item>
                <el-menu-item index="/home/tag">标签</el-menu-item>
                <el-menu-item index="/home/archive">归档</el-menu-item>
              </el-menu>
            </div>
            <div style="display: flex">
              <el-input v-model="input" placeholder="输入框待开发"></el-input>
              <div v-if="state == 0" style="width: 40px; margin-left: 20px">
                <a href="#">登录 </a>
              </div>
              <div v-else>
                <a href=""
                  ><img
                    src=""
                    alt=""
                    style="width: 20px; height: 20px; border-radius: 50%"
                /></a>
              </div>
            </div>
          </nav>
        </div>
      </el-header>
      <el-container class="box">
        <el-container>
          <el-main>
            <router-view></router-view>
          </el-main>
          <el-footer></el-footer>
        </el-container>
        <el-aside width="300px">
          <div style="margin-bottom:10px">
          <router-view name="SideView"></router-view>
          </div>
          <div style="margin-bottom:30px">
          <router-view name="Classify"></router-view>
          </div>
          <div>
          <router-view name="Tag"></router-view>
          </div>
        </el-aside>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // activeIndex: "/home/index",//用于设置选中时样式标签名 已用计算属性代替
      input: "", //待开发搜索框的同步值
      state: 0, //是否登录 到时候赋值登陆上变为 1 默认是 0 显示 ‘登录’ 两个字 为 1 时显示头像img点击可以跳转到后台登陆页面
    };
  },
  
  computed: {
    handleSelect() {
      //计算属性触发 来自动选择上方导航栏的使用样式
      return this.$route.fullPath;
    },
  },
  methods: {
    
  },
};
</script>

<style scoped>
a {
  text-decoration: none;
}
.header {
  position: sticky;
  top: 0;
}
.box {
  width: 1400px;
  margin: 0 auto;
}
.el-header,
.el-footer {
  background-color: #fff;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside {
  line-height: 260px;
}
</style>
